﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Web.Entity;

namespace Web.Entity.Indexer
{
    public class User
    {
        public static Web.Entity.User SetFieldsValue(DataRow dr)
        {
            Web.Entity.User obj = new Web.Entity.User();
            obj.Age = (int)dr["Age"];
            obj.RealName = dr["RealName"] as string;

            return obj;
            
        }

        public static SqlParameter[] GetSqlParamsValue(Web.Entity.User dataObj)
        {
            List<SqlParameter> lstParams = new List<SqlParameter>();

            lstParams.Add(new SqlParameter("@UserName",dataObj.UserName));
            lstParams.Add(new SqlParameter("@RealName",dataObj.RealName));
            lstParams.Add(new SqlParameter("@Age", dataObj.Age));

            return lstParams.ToArray();
        }
    }
}
